const express = require('express')
const article_handler = require('../router_handler/article.js')
const router = express.Router()
const multer = require('multer')
const path = require('path')
// 创建 multer 的实例对象，通过 dest 属性指定文件的存放路径
const upload = multer({ dest: path.join(__dirname, '../uploads') })
const expressJoi = require('@escook/express-joi')
const { add_article_schema } = require('../schema/article')
router.get('/getArticles',article_handler.getArticles)

router.get('/getArticlesDetail/:id',article_handler.getArticlesDetail)

router.post('/add', expressJoi(add_article_schema), article_handler.addArticle)

router.post('/correct/:Id', expressJoi(add_article_schema), article_handler.correctArticle)

router.get('/delete', article_handler.deleteArticle)

module.exports = router